snapshot: Reorder color matrix nodes containing a transform node
authorTimm Bäder <mail@baedert.org>
Fri, 29 Nov 2019 08:14:55 +0000 (09:14 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 3 Dec 2019 07:40:34 +0000 (08:40 +0100)
commit05e9a9b572b4f1d1dbebf70812ebfa440a3ff8b9
treeb38d008950585f2e9994f5b54a08eda2353d59a8
parentbc7b37d307a4d0959df3d90aa3f99bcdc2ccfd7d
snapshot: Reorder color matrix nodes containing a transform node

A color matrix node that contains a transform node can also be expressed
the other way around, as a transform node containing a color matrix
node.

In the general case, the color matrix node will have to draw its
child to a texture so it can color every pixel of that texture, but the
renderers can short-cut this if the child of the color matrix node is
already a texture node. So if we have a node tree like

Color Matrix
    - Transform
        - Texture

The renderer would have to either check the grandchild of the color
matrix or simply fall back to rendering the transform node to a texture.

In the new configuration:

Transform
    - Color Matrix
        - Texture

The renderer can easily see that the child node of the color matrix node
is a texture, and skip rendering it to a texture.

This is for example happening in current Adwaita for spinners, which are
rotated symbolics.
gtk/gtksnapshot.c